package test3;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.Socket;

public class server extends Thread {
    private Socket socket;

    public server(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            InputStream ist = socket.getInputStream();
            byte[] bytes = ist.readAllBytes();
            long l = System.currentTimeMillis();


            FileOutputStream fos = new FileOutputStream(new File("C:\\java\\film\\ "+ l + ".txt"));


            fos.write(bytes);
            fos.close();
            ist.close();
            socket.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
